Skip to content

feat: Software Factory Harness - observability, reliability and gate loop - #7

Open
mmunisamy-emergence wants to merge 1 commit into
mainfrom
feat/dark-factory-harness
Open

feat: Software Factory Harness - observability, reliability and gate loop#7
mmunisamy-emergence wants to merge 1 commit into
mainfrom
feat/dark-factory-harness

Conversation

@mmunisamy-emergence

Copy link
Copy Markdown
Collaborator

Summary

  • Renames orchestrator/ to harness/ (Dark Factory execution engine)
  • Builds the full observability, reliability, and gate-loop stack on top of the existing provenance foundation
  • Adds operator TUI and team-lead web dashboard for live monitoring

Changes

Harness (deterministic step loop)

harness/harness.py owns research -> plan -> implement -> gate-loop -> PR; calls each skill individually, reads structured gate JSON, retries with /fix-failures; integrates all reliability primitives.

Reliability primitives

  • harness/scrubber.py — regex scrubs secrets from provenance output before write
  • harness/locks.py — fcntl per-repo file lock; prevents concurrent runs on same repo
  • harness/checkpoint.py — atomic checkpoint after each step; survives crashes; resume support
  • harness/circuit_breaker.py — opens after 5 cross-run gate failures; CLI reset
  • harness/watchdog.py — background thread; warns at 15-45 min, kills at hard limit

Observability server

harness/server.py — FastAPI; 14 REST + SSE endpoints; hand-rolled Prometheus /metrics (no prometheus_client dep); auto-starts via PID file on first harness implement run.

User interfaces

  • harness/tui.py — Rich terminal dashboard for operators; live refresh, gate health bars, key bindings (w=watch, c=cancel, r=refresh)
  • harness/dashboard/index.html — vanilla-JS web dashboard for team leads; SSE live updates, 7-day gate health heatmap, run detail panel, circuit-breaker alert banner

Provenance enhancements

harness/provenance.py adds cost_usd/tokens_in/tokens_out per event; flakiness detection; rotate() archival; total_cost(), flaky_gates() analysis helpers.

Verification gate skills

  • skills/run-linter/ — auto-fix pass then errors; writes structured JSON result
  • skills/run-tests/ — full suite excl. tests/evals/; writes JSON result
  • skills/run-evals/ — acceptance-criteria tests per issue; writes JSON result
  • skills/run-code-review/ — blockers-only parallel review; writes JSON result
  • skills/fix-failures/ — reads failures JSON, applies targeted fixes per gate type
  • skills/verify-and-fix/ — standalone 4-gate retry loop for skill-mode use

New CLI commands

watch, queue, cancel, resume, circuit-breaker status/reset, tui, server, cost, runs

Test plan

  • 34-check functional test suite — all pass (scrubber, checkpoint, circuit breaker, provenance, token parsing, locks, watchdog, CLI)
  • Existing integration tests (test_orchestrator.py, test_adapter.py) — both pass
  • All 10 harness modules import cleanly
  • Server degrades gracefully when FastAPI not installed (no crash)
  • End-to-end run with a real Jira issue — requires live Jira MCP + Claude CLI

gh pr create
--title "feat: Dark Factory harness — observability, reliability & gate loop"
--body-file /tmp/pr_body.md

Renames `orchestrator/` → `harness/` and builds the complete Dark Factory
control plane on top of the existing provenance foundation.

## Harness (deterministic step loop)
- `harness/harness.py` — owns research→plan→implement→gate-loop→PR cycle;
  calls each skill individually via subprocess, reads structured gate JSON,
  retries with /fix-failures; integrates all reliability primitives below

## Reliability primitives
- `harness/scrubber.py`        — regex scrubs secrets from provenance output
- `harness/locks.py`           — fcntl per-repo file lock; prevents concurrent runs
- `harness/checkpoint.py`      — atomic checkpoint after each step; crash resume
- `harness/circuit_breaker.py` — opens after 5 cross-run gate failures; CLI reset
- `harness/watchdog.py`        — background thread; warns at 15–45 min, kills at limit

## Observability server
- `harness/server.py`          — FastAPI; 14 REST+SSE endpoints, hand-rolled
  Prometheus /metrics (no prometheus_client dep); auto-starts via PID file

## User interfaces
- `harness/tui.py`             — Rich terminal dashboard (operators); live refresh,
  gate health bars, key bindings (watch/cancel/refresh)
- `harness/dashboard/index.html` — vanilla-JS web dashboard (team leads); SSE live
  updates, gate heatmap, run detail panel, circuit-breaker banner

## Provenance enhancements
- `harness/provenance.py`      — adds cost_usd/tokens_in/tokens_out per event,
  flakiness detection (pass without fix), rotate() archival, total_cost(),
  flaky_gates() analysis helpers

## Verification gate skills
- `skills/run-linter/SKILL.md`      — auto-fix pass then errors; writes JSON result
- `skills/run-tests/SKILL.md`       — full suite excl. evals/; writes JSON result
- `skills/run-evals/SKILL.md`       — acceptance-criteria tests; writes JSON result
- `skills/run-code-review/SKILL.md` — blockers-only verdict; writes JSON result
- `skills/fix-failures/SKILL.md`    — reads failures JSON, applies targeted fixes
- `skills/verify-and-fix/SKILL.md`  — standalone 4-gate retry loop (skill mode)

## CLI additions (python -m harness <cmd>)
watch, queue, cancel, resume, circuit-breaker status/reset,
tui, server, cost, runs, provenance stats/runs/export
@mmunisamy-emergence mmunisamy-emergence changed the title feat: Dark Factory harness - observability, reliability and gate loop feat: Software Factory Harness - observability, reliability and gate loop Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant